<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<title>ECharts</title>
	<!-- 引入 echarts.js -->
	<script src="lib/dist/echarts.min.js"></script>
</head>

<body style="background-color:rgb(42,42,42)">
	<!-- 为ECharts准备一个具备大小（宽高）的Dom -->
	<div id="main" style="width: 750px;height:450px;"></div>
	<script src="dark.js" type="text/javascript"></script>
	<script src="chalk.js" type="text/javascript"></script>
	<script type="text/javascript">

		// 基于准备好的dom，初始化echarts实例
                var myChart = echarts.init(document.getElementById('main'),'dark');
                function init() {
                                        var option = {
                                                //backgroundColor:"rgba(0,0,0,0.8)",
                                                title: {
                                                        text: "对数轴示例",
                                                        x: "center"
                                                },
                                                tooltip: {
                                    backgroundColor:'rgba(0,0,0,0.5)',
                                                        trigger: "item",
                                                        formatter: "{a} <br/>{b} : {c}"
                                                },
                                                legend: {
                                                        x: 'left',
                                                        data: ["2的指数", "3的指数"]
                                                },
                                                xAxis: [
                                                        {
                                                                type: "category",
                                                                name: "x",
                                                                splitLine: { show: false },
                                                                data: ["一", "二", "三", "四", "五", "六", "七", "八", "九"]
                                                        }
                                                ],
                                                yAxis: [
                                                        {
                                                                type: "log",
                                                                name: "y"
                                                        }
                                                ],
                                                toolbox: {
                                                        show: true,
                                                        feature: {
                                                                mark: {
                                                                        show: true
                                                                },
                                                                dataView: {
                                                                        show: true,
                                                                        readOnly: true
                                                                },
                                                                restore: {
                                                                        show: true
                                                                },
                                                                saveAsImage: {
                                                                        show: true
                                                                }
                                                        }
                                                },
                                                calculable: true,
                                                series: [
                                                        {
                                                                name: "3的指数",
                                                                type: "bar",
                                                                data: [1, 3, 9, 27, 81, 247, 741, 1223, 5669]

                                                        },
                                                        {
                                                                name: "2的指数",
                                                                type: "bar",
                                                                data: [1, 2, 4, 8, 16, 32, 64, 228, 156]

                                                        }
                                                ]
                                        };

                                        myChart.setOption(option);
                                }
                function initBar(str) {
			var option = {
                                backgroundColor:"rgba(0,0,0,0.8)",
				title: {
                                        text: "Field Statistic",
					x: "center"
				},
				tooltip: {
                                        backgroundColor:'rgba(0,0,0,0.5)',
					trigger: "item",
					formatter: "{a} <br/>{b} : {c}"
				},
				legend: {
					x: 'left',
                                        data: ["kind num"]
				},
				xAxis: [
					{
						type: "category",
						name: "x",
						splitLine: { show: false },
                                                data:str["xAxisData"]
                                                //data: ["一", "二", "三", "四", "五", "六", "七", "八", "九"]
					}
				],
				yAxis: [
					{
                                                //type: "log",
						name: "y"
					}
				],
				toolbox: {
					show: true,
					feature: {
						mark: {
							show: true
						},
						dataView: {
							show: true,
							readOnly: true
						},
						restore: {
							show: true
						},
						saveAsImage: {
							show: true
						}
					}
				},
				calculable: true,
				series: [
					{
                                                name: "frequency",
                                                type: "bar",
                                                data: str["yAxisData"]
					}
				]
			};

			myChart.setOption(option);
		}

		function setSize(size) {
		    // 首先是取到元素
			var main = document.getElementById('main');
			main.style.width = size["width"] + "px";
			main.style.height = size["height"] + "px";
			myChart.resize();
		}
		window.onresize = myChart.resize;
                //init();


	</script>
</body>

</html>
